package main

import (
	"fmt"
	"github.com/pkg/errors"
)

func tryrecover() {
	defer func(){
		r := recover()
		if err,ok := r.(error); ok {
			fmt.Println("Error occur", err)
		}else {
			panic(r)
		}
	}()
	panic(errors.New("this is a error"))
}
func main() {
	tryrecover()
}
